import router from './router';
import NProgress from 'nprogress';
import 'nprogress/nprogress.css';

// 简单配置
NProgress.inc(0.2);
NProgress.configure({ easing: 'ease', speed: 500, showSpinner: true });
//路由拦截
router.beforeEach((to, from, next) => {
  //处理页面位置
  if (to.fullPath === '/') {
    router.push('/baseStudy');
  }
  // if(to.name != 'login' && !commonUtil.getCookie('login')){
  //   // Vue.showAlert('未登录，已经调整到首页')
  //   router.push('/login')
  //   return
  // }
  //路由跳转时，添加进度条
  NProgress.start();
  next();
});

router.afterEach(() => {
  NProgress.done();
});
